/*
 * topological-hex, a program to compute combinatorial hexahedral meshes.
 *
 * Copyright (C) <2018> <Université catholique de Louvain (UCL), Belgique>
 *
 * List of the contributors to the development, description and complete
 * License: see LICENSE file.
 *
 * This program (topological-hex) is free software:
 * you can redistribute it and/or modify it under the terms
 * of the GNU General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program (see COPYING file).  If not,
 * see <http://www.gnu.org/licenses/>.
 */

#ifndef LOWER_BOUND_H_
#define LOWER_BOUND_H_

#include "solver.h"

error_code load_lower_bounds(const char *filename);
void release_lower_bounds(void);

error_code load_known_solutions(const char *filename);
void release_known_solutions(void);


void component_lower_bound(
  solver *solver,
  quad_index *quads, uint32_t num_quads,
  vertex_index *v_min,
  hex_index *h_min);

typedef struct upper_bounds_table {
  size_t num_entries, capacity, element_size;
  uint8_t *hash_table;

  size_t symmetries_size, symmetries_capacity;
  vertex_index *symmetries;
} upper_bounds_table;

error_code init_upper_bounds_table(upper_bounds_table *table,
                                   uint32_t num_boundary_quads,
                                   uint32_t num_vertices);

void release_upper_bounds_table(upper_bounds_table *table);

bool look_up_upper_bound(
  solver *solver, quad_index *quads, uint32_t num_quads);

void check_known_solutions(solver *solver,
                           quad_index *quads, uint32_t num_quads);

#endif
